<template>
  <div class="all">
    <div class="visit_txt">
     跟进回访 
    </div>
    <van-form v-model="visit" class="visit_content" @submit="submit_visit">
      <input-time :is_min_date="false"  v-model="visit.visit_time" txt_tip="回访时间"></input-time>

      <new-item class="wrap_input" v-model="visit.mobile" txt_tip="电话" />
      <new-item class="wrap_input" class_type="textarea" v-model="visit.msg" txt_tip="回访记录" />

      <button class="c_flex visit_button">
        确定
      </button>
      <div @click="visit_log" class="visit_log">
        回访历史
      </div>
    </van-form>



  </div>
</template>

<script>
  import InputTime from "@/components/TimePicker/InputRealTime"
  import NewItem from '../form/NewItem.vue'
  import moment from 'moment';
  import {
    VisitService
  } from '@/api'
  export default {
    name: 'VisitForm',
    components: {
      InputTime,
      NewItem,
    },
    methods: {
      visit_log() {
        this.$router.push({
          path: 'visit_log',
          query: {
            id: this.$route.query.id,
          }
        })
      },
      submit_visit() {
        this.visit = Object.assign({}, this.visit,{franchisee_id:this.$route.query.id})
        VisitService.visit(this.visit).then(res => {
          console.log(res);
          if (res.code == 10000) {
            this.$toast("回访记录录入成功！")
            this.visit = Object.assign({}, this.$options.data().visit)
          }
        })
      },
      
    },
    data() {
      return {
        other_money: '',
       
        visit: {
          visit_time: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
          mobile: '',
          msg: '',
        }
      }
    },
    

  }
</script>

<style lang="less" scoped>
  .all {
    margin: 0;
    padding: 40px 24px;
    background-color: #f3f5f7;
    min-height: calc(93vh);
    box-sizing: border-box;

    .visit_txt {
      color: rgba(51, 51, 51, 1);
      font-size: 24px;
      margin-bottom: 15px;
    }

    .visit_content {
      width: 702px;
      height: 618px;
      background-color: rgba(255, 255, 255, 1);
      border-radius: 16px;
      padding-top: 25px;
      margin-bottom: 20px;

      .wrap_input {
        margin: 30px auto 0px;
        width: 75%;
      }

      .visit_button {
        width: 420px;
        height: 80px;
        background-color: rgba(242, 147, 33, 1);
        border-radius: 8px;
        color: rgba(255, 255, 255, 1);
        font-size: 28px;
        border-width: 0px;

        margin: 50px auto 30px;
      }

      .visit_log {
        color: rgba(102, 102, 102, 1);
        font-size: 20px;
        text-align: center;
      }
    }
  }
</style>